package com.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

//@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.REPEATABLE_READ,readOnly = false,timeout = -1)
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Throwable.class})
@Service
public class BookService {
 /*   @Resource
    private BookMapper bookMapper;
    public List<Book> selectBooks(){
        PageHelper.startPage(4, 5);//PageHelper 来自分页插件
        List<Book> users = this.bookMapper.selectAll();//查询语句
        PageInfo<Book> pageInfo = new PageInfo<Book>(users,5); //PageInfo 来自分页插件
        System.out.println("当前页 : " + pageInfo.getPageNum());
        System.out.println("总记录数 :" + pageInfo.getTotal());
        System.out.println("每页的记录数 : " + pageInfo.getPageSize());
        System.out.println("总页数 : " + pageInfo.getPages());
        System.out.println("是否是首页 : " + pageInfo.isIsFirstPage());
        System.out.println("是否是最后一页 : " + pageInfo.isIsLastPage());
        int[] nums = pageInfo.getNavigatepageNums();
        for(int i = 0 ; i < nums.length; i++){
            System.out.print(nums[i] + " , ");
        }
        System.out.println("-------------------------------");
        System.out.println(JackUtil.objecToString(pageInfo));
        System.out.println("-------------------------------");
        return pageInfo.getList() ;
    }
    public Integer saveBook(Book book){
        int temp = bookMapper.insert(book);
        return temp;
    }*/
}
